/*
Problem:    修改文章
Assemble:   NOIP_moni_10
Anthor:     Alchemist
Date:       2011.11.4
Tag:
Difficulty
Description:
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <list>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
const int maxn = 2000000 + 1;
int n;
int f[maxn];
bool hash[4][27*27*27*27];
char str[maxn];

int main()
{
    freopen("cost.in","r",stdin);
    freopen("cost.out","w",stdout);
    cin >> n;
    string s;
    for(int i = 0; i < n; i ++)
    {
        cin >> s;
    }
    cin >> m;
    for(int i = 0; i < m; i ++)
    {
        cin >> str[i];
    }

    for(int i = 0; i < m ; i ++)
    {
    }
    cout << f[m-1] << endl;
    return 0;
}
